UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BXyYyiK6bAlVb/lYO2yAQxSiOMY7sCobVTUWUtjmSro=' 
WHERE 
  key_id = 'b1c1399ec3548a759254305749b3deb5bb6cf5b6b4330cbe4a6a5638202a543f' 
  AND (
    token = 'BXyYyiK6bAlVb/lYO2yAQxSiOMY7sCobVTUWUtjmSro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030