UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7lM9D3ByVxrZMOTaff3noek9I6yeAFbkKWXerYENu4M='
WHERE
key_id = '158daae717d32780aaf04412a4f0cabe0d09a893ece30bcbfaf5621cf3d9a3ee'
AND (
token = '7lM9D3ByVxrZMOTaff3noek9I6yeAFbkKWXerYENu4M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)