UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tmJ3lFwVNY0YiUm4KEahMbV4AqMJosncjnCe9rtNHGI='
WHERE
key_id = 'a4628ce852fff500f1a11182c2dcba7f59fee812fbb18b62f91fa511dc0c3b54'
AND (
token = 'tmJ3lFwVNY0YiUm4KEahMbV4AqMJosncjnCe9rtNHGI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)