UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iIcEI/2x3etw880dEpQPQtgkRhLJBIX1slFhUC+O/yg=' 
WHERE 
  key_id = '7179bf648cbdabe984a120bfb1961dceeb0cf1346eeb3130d2de1eab038a2b95' 
  AND (
    token = 'iIcEI/2x3etw880dEpQPQtgkRhLJBIX1slFhUC+O/yg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020