UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8cEO0YVbn5UTXYG6H9wxkMzsBfhHj4PTjniSssBfmD8='
WHERE
key_id = '3dafaa2ee342bab44995b71a7eb14f77da0fe4b9137d1ffba3241b305dadc9d1'
AND (
token = '8cEO0YVbn5UTXYG6H9wxkMzsBfhHj4PTjniSssBfmD8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)