UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qoTH6DD4FYbIYAIW6ShGgo5OkiGDQRQpZEYbZPY3Vy0='
WHERE
key_id = '1165ea475439fe2d749ac0997804e45c1c7a6ddc412f42755269ae32ffbc8e0b'
AND (
token = 'qoTH6DD4FYbIYAIW6ShGgo5OkiGDQRQpZEYbZPY3Vy0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)