UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r4LJ13jRrJbQQtfPV4MywQHvh68uARe/6otUcPbMN7E=' 
WHERE 
  key_id = '577d79b10e6b717c8a58ff5800f73fffe8822308c507193f648b297c313747df' 
  AND (
    token = 'r4LJ13jRrJbQQtfPV4MywQHvh68uARe/6otUcPbMN7E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037