UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/hkJ4bGt2yiHV9WRb0WePYWtXeYFrxnPCpXUS7vsxw4='
WHERE
key_id = '21836a7f7cb5be6771e3858c25b232e697a77b7a7b8d39bf7571ab0310655de3'
AND (
token = '/hkJ4bGt2yiHV9WRb0WePYWtXeYFrxnPCpXUS7vsxw4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)