UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9Afj2QhFTffPOfHdFh7Ma8u4bCWous6BoFPq3kEX7C4='
WHERE
key_id = '53596af582038c9eb13207075a4df6e4e8bc5628abda7a893f79aafac65a98a4'
AND (
token = '9Afj2QhFTffPOfHdFh7Ma8u4bCWous6BoFPq3kEX7C4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)