UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '81AGWze4Gr/YOJpsnqXpTMG6EfN9kK1wd7G9i6MIEnM='
WHERE
key_id = 'e798c4b17b16db13ce6961b2fa7e67a8a7ba043ec05f2cf3976d538edad40dd4'
AND (
token = '81AGWze4Gr/YOJpsnqXpTMG6EfN9kK1wd7G9i6MIEnM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)