UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZYc1TY6sSVfCl/1PTzhvzV+ZiqPHUufppgR8tSBebfw=' 
WHERE 
  key_id = '6da4ea134425b7d7ecd5aaf721205d56caa11ef9585c8dca4a0f7136df7e288e' 
  AND (
    token = 'ZYc1TY6sSVfCl/1PTzhvzV+ZiqPHUufppgR8tSBebfw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054