UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M6GHvoUGRfoxYb2zHvm0rrr2sM/y4iJDAqCxVebZTcU=' 
WHERE 
  key_id = 'a094c7f833fab1e13a0e3d93902549c5a760bf3530558acbf38007759a917699' 
  AND (
    token = 'M6GHvoUGRfoxYb2zHvm0rrr2sM/y4iJDAqCxVebZTcU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055