UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j+4OVMaMMB3mtpKjyYgYkitOY2afCmD/1Zmpb10QOAw='
WHERE
key_id = 'e5a7c712707699d02767434a705e338511987ab0c4588670f3c8f61b14fd9d8e'
AND (
token = 'j+4OVMaMMB3mtpKjyYgYkitOY2afCmD/1Zmpb10QOAw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)