UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'otpPpnlwxpRzfxxJiiE5287n/P3T7wMl2ZHKivO+YR8='
WHERE
key_id = '3a4c414c04fcd735021b39d696c99d2856b591961bb7c623a8e2d5c530bfa874'
AND (
token = 'otpPpnlwxpRzfxxJiiE5287n/P3T7wMl2ZHKivO+YR8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)