UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JoHWCMTrlBYfRliTvyohZyhLogiGFB51+myDuk1xEL8=' 
WHERE 
  key_id = 'f688d778ad039ac85dd1c6ffb07cac7d0ec7f9d425aa24de987048259d0cfd52' 
  AND (
    token = 'JoHWCMTrlBYfRliTvyohZyhLogiGFB51+myDuk1xEL8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028