UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0SMfod7JeHWOye/IpwNmABrSJlxbfkfJf7JsKOXaE50=' 
WHERE 
  key_id = '8c95c2b54ac22b755ae7bfd80d4eb816f4b24b10f69bfb4b59bca4cbc636b804' 
  AND (
    token = '0SMfod7JeHWOye/IpwNmABrSJlxbfkfJf7JsKOXaE50=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029