UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pB+csPjJy4MPjy/9nD4RF1o2+hH+4P0Wae4Uy2hggDg='
WHERE
key_id = 'e3ac9824cebefcd1e86f513c43564264f7ea6d647e54c732ee5d01d45ef746ac'
AND (
token = 'pB+csPjJy4MPjy/9nD4RF1o2+hH+4P0Wae4Uy2hggDg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)