UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W54NbBB6yAVVKHxmESeLn3RV7SvLmsqOQY+zDB1xalk='
WHERE
key_id = '6b4154d182b04a805723bf1758199df6bb7b2ff9ef2bacb87f93ddee8fec9e2a'
AND (
token = 'W54NbBB6yAVVKHxmESeLn3RV7SvLmsqOQY+zDB1xalk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)