UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a3X9FqdQP2tM75+jObbT+N5J6w8DYN8y9e+hEsRiShM='
WHERE
key_id = 'bdd55675cf414aae92f76e618ce2bd81a0297d9381e90fe3ee83c6bf83c069f2'
AND (
token = 'a3X9FqdQP2tM75+jObbT+N5J6w8DYN8y9e+hEsRiShM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)