UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8WRZf4WWvFqTh2OmM14DF0QNP0K9fnBpWrYJ6BiGcYk='
WHERE
key_id = 'e65785b175f67434ce27e76a5d1b1d010c31d58254dd64acbe8f5c3218fdadeb'
AND (
token = '8WRZf4WWvFqTh2OmM14DF0QNP0K9fnBpWrYJ6BiGcYk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)