UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zWFoVtq4Rkph2I4lrAKdam5ZqAojYuQzxwx7SgJOAw4='
WHERE
key_id = 'f792bcdc549fe5e8775dd90a3150a38068e51c542ee35aa464684c504c403f90'
AND (
token = 'zWFoVtq4Rkph2I4lrAKdam5ZqAojYuQzxwx7SgJOAw4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)