UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jqb6nyBhCHf1e1+L2d1m/CRRi7P8fQF3JMB3awivJOs=' 
WHERE 
  key_id = '40a6ffa03286c4cda6c76e2793b329c9b3b014286a8ba34d7bc94dfcb9d0a7d8' 
  AND (
    token = 'jqb6nyBhCHf1e1+L2d1m/CRRi7P8fQF3JMB3awivJOs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045