UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P7duEzuWuTFr+m4LOm8jSEDwppvf0FHfZpa+v88rANc='
WHERE
key_id = '114c6496b60f28ab43c4c0551deebd46b0c73fcab70bc38536336ec341ced21c'
AND (
token = 'P7duEzuWuTFr+m4LOm8jSEDwppvf0FHfZpa+v88rANc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)