UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i12qm02eAkhPf6vo/yzDXiibzE26NzDPdwlmhQLHi3s='
WHERE
key_id = 'd6a50630adb536b4a116b70e41d439d35d1b6f4e97e42017ab1f0dd54732759a'
AND (
token = 'i12qm02eAkhPf6vo/yzDXiibzE26NzDPdwlmhQLHi3s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)