UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O8tQiXLQeDi2bHOfbeAfaQkXJOu2ZM8xkzc8xXR3Ecc='
WHERE
key_id = 'c5a7911dbe503c8db8d93ea1ff95b2652c3046edca91eae37eea9441438dd8d3'
AND (
token = 'O8tQiXLQeDi2bHOfbeAfaQkXJOu2ZM8xkzc8xXR3Ecc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)