UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7g1+a47rHJm5XXC7KhUqMdJKHabxrQPfVYWr9Lmz104='
WHERE
key_id = 'a5eaad11750df3ab1d025da1d0c821421291c45fdaccb7d7216f30b30d2b6626'
AND (
token = '7g1+a47rHJm5XXC7KhUqMdJKHabxrQPfVYWr9Lmz104='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)