UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'agB+IgrHYgFhtVGVjUapnTnApCrawG9nRIvt/jj8iYA='
WHERE
key_id = '12f59134e26294b83ce2aa46177e4743387d6481c43a811cb6ca6fb9d1ce0203'
AND (
token = 'agB+IgrHYgFhtVGVjUapnTnApCrawG9nRIvt/jj8iYA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)