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