UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'byJFoD7B62B3MFXAtBPs+ZZmAXK3Ef1uE8AsmTVlLTs=' 
WHERE 
  key_id = 'fe0e4318bcc2b3232b66ae0c7ce49c8dcb81cb6bd914b255199f206b3aee8a7e' 
  AND (
    token = 'byJFoD7B62B3MFXAtBPs+ZZmAXK3Ef1uE8AsmTVlLTs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00423