UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5tpAz7uZXHwLrmaF0wx8SM+Cr0eSMK3RTCprrWHO3c8='
WHERE
key_id = '197b8c5acec3186a2103d964d9f8dd6ca9218c1eb03c9911f113439336d27f2c'
AND (
token = '5tpAz7uZXHwLrmaF0wx8SM+Cr0eSMK3RTCprrWHO3c8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)