UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GShZ0+vZL3drHvPyBNLbNG1Ghwky1xSPwj42+JtT/9A='
WHERE
key_id = 'b31e60836cce6d260d3723ccccc211d36a50e83aae3634e1140c4af0b104acc4'
AND (
token = 'GShZ0+vZL3drHvPyBNLbNG1Ghwky1xSPwj42+JtT/9A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)