UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yXYo2kam240tFgf8hDTAFNq2exBYiIjMrHniMPH0baY=' 
WHERE 
  key_id = '55eb4b12f967c954bafc6210296394eb33b507cd0f28c91cb96544aa97200a28' 
  AND (
    token = 'yXYo2kam240tFgf8hDTAFNq2exBYiIjMrHniMPH0baY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035