UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZxW4t27iV+IQxNNksv5piWKZ4bw8Suzdn9xevHj8+1U='
WHERE
key_id = 'dbac42ea0ce9bcf69f33ae50d3660c989909108001fae3ff91e70c81073f2e07'
AND (
token = 'ZxW4t27iV+IQxNNksv5piWKZ4bw8Suzdn9xevHj8+1U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)