UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P2Rf/YPitW6S33eiEjzi80Q/5ZEQZj+4ePS97U8ed60='
WHERE
key_id = '38843939509b000b694430178c95f34828f657d0e7230cc91c1744c5efd3fe3c'
AND (
token = 'P2Rf/YPitW6S33eiEjzi80Q/5ZEQZj+4ePS97U8ed60='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)