UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o17EzDwsqnMXtT0Z+fntWU4pog+yblXKU5rKJ/n8qH0=' 
WHERE 
  key_id = '65f45cc3976df56c4683252024a2989a95785f8d7e6369b554d86e904f1faa49' 
  AND (
    token = 'o17EzDwsqnMXtT0Z+fntWU4pog+yblXKU5rKJ/n8qH0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00061