UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZGBQhzP1h9+mHpb9vxOvvitHAl8a5UpSDsJIbk1CmD4=' 
WHERE 
  key_id = 'b4550d1b3464a65e0a345626b5d935e51547c671c3ff86e9d785475bf9861114' 
  AND (
    token = 'ZGBQhzP1h9+mHpb9vxOvvitHAl8a5UpSDsJIbk1CmD4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051