UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g3i4x41GYgSyPw0NzPpJ6RhlmXpmZXoT61yZtM0avxI='
WHERE
key_id = '7822f7496b0ab0f3e67fb493478bd7f8d4dbc32bfa71ecc7c47055e3d6da9f18'
AND (
token = 'g3i4x41GYgSyPw0NzPpJ6RhlmXpmZXoT61yZtM0avxI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)