UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mZXnsxagC2Un5T8H3V4vqEr3hOklvpHS9JSGfn1wGgo='
WHERE
key_id = 'a94995492443401553cbf87e65aa62f07b142964d76a0229630c034bef2c4344'
AND (
token = 'mZXnsxagC2Un5T8H3V4vqEr3hOklvpHS9JSGfn1wGgo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)