UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JelvW9h/gR8V+ohTSOHP4MCikV5/VzKlPDaKzwEb2IQ=' 
WHERE 
  key_id = '9a1c968d0a90eade5000a04687538be1053ee17fbe406736b0e5aad4c632927c' 
  AND (
    token = 'JelvW9h/gR8V+ohTSOHP4MCikV5/VzKlPDaKzwEb2IQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038