UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z2Sdi8cl1bGOO7Ej0mi7/I1aLIo3Vyyb1SI99vxJVto='
WHERE
key_id = 'cd417d182b5c6ed5855fc9303d30e4ef2a217484d564f4797bb9afcfdffe39f9'
AND (
token = 'Z2Sdi8cl1bGOO7Ej0mi7/I1aLIo3Vyyb1SI99vxJVto='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)