UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D+AniDrmrbTl5QOK1oN92S6kifHxOtRUJGXY2spx4M0='
WHERE
key_id = 'a42da27baeeac31cb7adddff08b5397ce97cb436d92de4dbcca09586692e03a8'
AND (
token = 'D+AniDrmrbTl5QOK1oN92S6kifHxOtRUJGXY2spx4M0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)