UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X6WjwHR9Lp6y4n8qcF89n2JRz3m12aK1cGgV+FIAWx8='
WHERE
key_id = 'a6808b5ff9d3d9e636486267fac0352db1d00e9a64bb27d21d5ee6b4c5fc2652'
AND (
token = 'X6WjwHR9Lp6y4n8qcF89n2JRz3m12aK1cGgV+FIAWx8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)