UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4QFxyI3CavWj9BCCo5msz73Q0Mr4tGgro1gsAAQNeXg='
WHERE
key_id = 'ce1e6b87e9da2861dfabba00b4c517f94405717bf56bcb6b0bc6ed5f1f6451f2'
AND (
token = '4QFxyI3CavWj9BCCo5msz73Q0Mr4tGgro1gsAAQNeXg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)