UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XvS+MHx5PNCxXe5CJbD5JcPHZUjs59LqszsoAom22HQ=' 
WHERE 
  key_id = '896f4a2d180dc6ed9b2e8c5787c65fe50b74af47e755a76d9f942df7c8ff9ec1' 
  AND (
    token = 'XvS+MHx5PNCxXe5CJbD5JcPHZUjs59LqszsoAom22HQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031