UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3ghiqHUU3iuqUyjV9R3L4Dmp39kwSrXtWFEmZjuqp+Q=' 
WHERE 
  key_id = '9d4ff7bffd8a77ac8a6ea373cdc51c2dad76129e370ca64bbbcb36e2c2176c22' 
  AND (
    token = '3ghiqHUU3iuqUyjV9R3L4Dmp39kwSrXtWFEmZjuqp+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021